<template>
  <div class="home">
    <!-- <div>首页</div> -->

    <div @click="getTextList">点击请求接口</div>
    <div v-for="(item, index) in list" :key="index">
      {{ item.product_name }}
    </div>

    <div @click="toFenbao">分包页面</div>
    <TabBar actIndex="0"></TabBar>
  </div>
</template>
<script>
import TabBar from "../../compoment/tebBar.vue";
import { textApi } from "@/http/api";
export default {
  components: {
    TabBar,
  },
  data() {
    return {
      list: [],
    };
  },
  onLoad() {},
  methods: {
    goUrl(title) {
      wx.navigateTo({
        url: `/pages/text/text?title=${title}`,
      });
    },

    async getTextList() {
      try {
        const res = await textApi();
        this.list = res.result;
      } catch (error) {
        console.log(error);
      }
    },

    toFenbao() {
      console.log("11");
      wx.navigateTo({
        url: `/pages/fenbao/index`,
      });
    },
  },
};
</script>
<style lang="less">
@import url("./style/index.less");
</style>
